<?php

	/*
	 * 商品搜索结果
	 */
?>

<div id="content">

<div id="mainContent_2">
<?php
if( isset( $pageVars['dbRes'] ) && count($pageVars['dbRes']) > 0 ) {
	$resultCount = $pageVars['result']['total']==1000?"1000+":$pageVars['result']['total'];
?>
<div id="searchhint">
	<p class="searchhint_t">
			在当前分类下共找到&nbsp;<span class="hilight">"<?php echoPageVar($pageVars, 'keyword');?>"</span>&nbsp;商品&nbsp;
		<span class="hilightNo"><?php echo $resultCount;?></span>&nbsp;件, 用时<?php echo $pageVars['result']['time'];?>秒：
	</p>
	<?php
	if( isset( $pageVars['dbGroupByRes'] ) && count( $pageVars['dbGroupByRes'] ) > 0 ) 
	{
  ?>
	<ul id="searchhint_category_less" class="searchhint_c">
	<?php
		$n = 0;
		foreach( $pageVars['dbGroupByRes'] as $item ){
			echo "<li><a href=\"javascript:ProductCatFilter(".$item['id'].")\">".$item['cate_name']."(".$item['count'].")</a></li>";
			$n++;
			//only display three here
			if( $n == 3 ){
				break;
			}
		}
	?>
		<li class="alllist"><a id="showAllCategory" href="#">显示全部类目</a></li>
	</ul>
	<ul id="searchhint_category_all" class="searchhint_c" style="display:none">
	<?php
		foreach( $pageVars['dbGroupByRes'] as $item ){
			echo "<li><a href=\"javascript:ProductCatFilter(".$item['id'].")\">".$item['cate_name']."(".$item['count'].")</a></li>";
		}
	?>
		<li class="alllist"><a id="showLessCategory" href="#">显示精简类目</a></li>
	</ul>
	<?php
	}
	?>
	<!--<ul class="searchhint_relate">
		<li>相关搜索：</li>
		<li><a href="#">Levis牛仔裤</a></li>
		<li><a href="#">Levis运动鞋</a></li>
		<li><a href="#">Levis衬衫</a> </li>
	</ul>-->
</div>
<?php
}
?>

<!-- advance search options-->
<form action="<?php echo edp_href_link(PAGENAME_PRODUCT_SEARCH_RESULT);?>" id="filterform" method="GET">
	<!--<input type="hidden" name="page" value="product_search_result" />-->
	<!-- select field must set as hidden  -->
	<input type="hidden" id="sortby" name="sortby" value="<?php echo echoPageVar($pageVars, 'sortby');?>" />
	<input type="hidden" id="location" name="location" value="<?php echo echoPageVar( $pageVars, 'location'); ?>" />
	<input type="hidden" id="category" name="category" value="<?php echoPageVar( $pageVars, 'cate_id' ); ?>" />
	<input type="hidden" id="keyword" value="<?php echoPageVar( $pageVars, 'keyword' ); ?>" />
	<input type="hidden" id="feature_list" value="<?php echoPageVar( $pageVars, 'feature' ); ?>" />
	<input type="hidden" id="plat_id" name="platid" value="<?php echoPageVar( $pageVars, 'plat_id' ); ?>" />

<?php
if( is_array($pageVars['suggestions'])&&count($pageVars['suggestions']) > 0 ) {
?>
	<div id="searchrelate">
		<span class="searchrelate_t">你是不是想找</span>：
        <?php foreach ( $pageVars['suggestions'] as $item ){?>
        <a href="<?php echo edp_href_link(PAGENAME_PRODUCT_SEARCH_RESULT, "q=".$item['keyword']);?>">
            <?php echo $item['keyword'];?>
        </a>
        <?php } ?>
	</div>
<?php
}
?>
	<div id="searchFilter">
		<span class="searchFilter_t" id="searchFilterTitle">请在这里选择过滤，以便更快的找到你想要的结果 </span>
        <div class="searchFilter_c" id="searchFilterContent">
			<table border="0" cellpadding="0" cellspacing="0" class="filter_table">
				<tr>
					<td>关键字：</td>
					<td>
						<input type="text" name="q" id="keyword" value="<?php echoPageVar( $pageVars, 'keyword' ); ?>" class="input_2"/>
					</td>
					<td>特色：</td>
					<td rowspan="2">
						<table  border="0" cellpadding="0" cellspacing="0" class="filter_table1">
							<tr>
								<td><input type="checkbox" class="input_checkbox" id="feature1" name="feature[]" value="1"/><label for="feature1">七天退货</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature2" name="feature[]" value="2"/><label for="feature2">30天保修</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature3" name="feature[]" value="3"/><label for="feature3">假一赔三</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature4" name="feature[]" value="4"/><label for="feature4">免邮</label></td>
							</tr>
							<tr>
								<td><input type="checkbox" class="input_checkbox" id="feature5" name="feature[]" value="5"/><label for="feature5">如实描述</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature6" name="feature[]" value="6"/><label for="feature6">送礼品</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature7" name="feature[]" value="7"/><label for="feature7">代购</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature8" name="feature[]" value="8"/><label for="feature8">海外商品</label></td>
							</tr>
							<tr>
								<td><input type="checkbox" class="input_checkbox" id="feature9" name="feature[]" value="9"/><label for="feature9">积分</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature10" name="feature[]" value="10"/><label for="feature10">发票</label></td>
								<td><input type="checkbox" class="input_checkbox" id="feature11" name="feature[]" value="11"/><label for="feature11">礼品</label></td>
								<td>&nbsp;</td>
							</tr>
						</table>
					</td>
					<td> <input type="submit" value="确定" class="btn_1"/></td>
				</tr>
				<tr>
					<td>价格区间：</td>
					<td>
						<input type="text" name="pricestart" id="pricestart" value="<?php echoPageVar( $pageVars, 'pricestart' ); ?>" class="input_3"/>
						至
						<input type="text" name="priceend" id="priceend" value="<?php echoPageVar( $pageVars, 'priceend' ); ?>" class="input_3" />
					</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
			</table>
		</div>
	</div>
</form>

<div id="search_filter_toolbar">
	<ul class="filter_tab">
		<li class="filter_shop" id="c2ctab"><h3>店铺</h3></li>
		<li class="filter_mall" id="b2ctab"><h3>商城</h3></li>
	</ul>
	<div id="filter_main">
		<div id="filter_main_m">
			<p>
                排序：
				<select id="selsortby" class="filter_1">
					<option value="">默认</option>
					<option value="price-asc">价格从低到高</option>
					<option value="price-desc">价格从高到低</option>
					<option value="review_count-desc">人气</option>
					<option value="score-desc">综合评分</option>
					<option value="rate-desc">性价比</option>
					<option value="service-desc">商家服务</option>
					<option value="velocity-desc">发货速度</option>
					<option value="reality-desc">商品真实度</option>
				</select>
				<select id="sellocation" class="filter_1">
					<option selected="selected" value="">所在地</option>
					<?php
				foreach( $pageVars['cityList'] as $key=>$value ) {
					echo "<option value=\"$value\">$key</option>\n";
				}
			?>
				</select>
				过滤：
				<select id="selplatfilter" class="filter_1">
					<option value="">全部</option>
					<option value="1">淘宝</option>
					<option value="4">百度</option>
					<option value="3">拍拍</option>
					<option value="2">易趣</option>
				</select>
				<ul class="filter_title">
                        <li id="sortprice"><span>价格</span></li>
                        <li id="sortservice"><span>商家服务</span></li>
                        <li id="sortreality"><span>商品真实度</span></li>
                        <li id="sortvelocity"><span>发货速度</span></li>
				</ul>
			</p>
		</div>
	</div>
</div>

<ul class="item_list">
	<?php
	if( isset( $pageVars['dbRes'] ) && count($pageVars['dbRes']) > 0 ) {
		foreach( $pageVars['dbRes'] as $item ) {
	?>
	<li class="item">
		<div class="item_data">
			<a href="#">
				<img src="<?php echo $item['pic_path']; ?>" alt="<?php echo $item['product_name_plain'] ; ?>" class="item_list_pic_product" />
			</a>
			<p class="item_t"><a href="<?php echo edp_href_link( PAGENAME_PRODUCT_INFO, "pid=".$item['id'] );?>"><?php echo $item['product_name'] ; ?></a></p>
			<p class="item_detail">来自：<a href="<?php echo edp_href_link(PAGENAME_PLATFORM, "platid=".$item['plat_id']); ?>"><?php echo $item['plat_name']; ?></a>&nbsp;&nbsp;
                            所在地：<a href="javascript:LocationFilter(<?php echo $item['location'];?>)"><?php echo $item['location_text'] ; ?></a></p>
			<p class="item_detail">分类：<a href="javascript:ProductCatFilter(<?php echo $item['cate_id'];?>)"><?php echo $item['cate_name']; ?></a>&nbsp;&nbsp;
                            店铺：<a href="<?php echo edp_href_link( PAGENAME_SHOP_INFO, "sid=".$item['shop_id'] );?>"><?php echo $item['shop_name']; ?></a></p>
		</div>
		<table border="0" cellpadding="0" cellspacing="0"  class="item_rank">
			<tr>
				<td rowspan="2" class="item_price"><?php echo intval($item['price']); ?></td>
				<td class="item_point"><?php echo $item['service']; ?></td>
				<td class="item_point"><?php echo $item['reality']; ?></td>
				<td class="item_point"><?php echo $item['velocity']; ?></td>
			</tr>
			<tr>
				<td colspan="3">
                                    <div>
                                        <center>
                                            <span class="score<?php echo getScoreClass($item['score']); ?>" title="<?php echo $item['score'];?>"></span>
                                        </center>
                                    </div>
                                    <br />
                                    <a href="<?php echo edp_href_link( PAGENAME_PRODUCT_INFO, "pid=".$item['id'] );?>"><?php echo $item['review_count']; ?>封点评</a></td>
			</tr>
		</table>
	</li>
		<?php
		}
	}
	else {
	?>
		<br /><br /><center>没有搜索到相关结果</center><br />
	<?php
	}
	?>
</ul>

<?php
//page bar
echoPageVar( $pageVars, "pagebar" );
?>

</div>



</div>
